package team.gs.control;

import org.andengine.engine.Engine;
import org.andengine.engine.camera.ZoomCamera;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import team.gs.Listener.loadResourcesListener;
import team.gs.model.ResourcesLoader;
import team.gs.model.Share;
import vn.freestore.paralletkill01.Parallet;
import android.graphics.Color;

public class ResourcesManager {
	private static final ResourcesManager INSTANCE = new ResourcesManager();
	public Engine engine;
	public Parallet activity;
	public ZoomCamera camera;
	private loadResourcesListener loadresources;
	public VertexBufferObjectManager vbom;
	// load
	public ITextureRegion load_logo_region;
	// login
	public ITextureRegion login_bg_region;

	public static void prepareManager(Engine engine, Parallet activity,
			ZoomCamera camera, VertexBufferObjectManager vbom) {
		getInstance().engine = engine;
		getInstance().activity = activity;
		getInstance().camera = camera;
		getInstance().vbom = vbom;
	}

	public void setLoadResources(loadResourcesListener lL) {
		this.loadresources = lL;
	}

	public static ResourcesManager getInstance() {
		return INSTANCE;
	}

	public void loadCompany() {
		load_logo_region = ResourcesLoader.loadResources("logo_company.png");
	}

	public void unloadCompany() {
		load_logo_region = null;
	}

	public void loadFont() {
		Share.black20 = ResourcesLoader
				.loadTTFFont("bold.ttf", 20, Color.BLACK);
	}

	public void loadAudio() {

	}

	public void loadResourcesOne() {
		System.out.println("LOAD ONE");
		loadResForHuy();
		System.out.println("END LOAD ONE");
	}

	public void loadResForHuy() {
		login_bg_region = ResourcesLoader.loadResources("login_bg.jpg");
		loadresources.RunApp();
	}

	public void unloadRsOne() {
		System.out.println("UNLOAD ONE");
		login_bg_region = null;

		System.out.println("END UNLOAD ONE");
	}

	public void loadResourcesTow() {
		System.out.println("LOAD TOW");

		loadresources.RunApp();
		System.out.println("Run play");
	}

	public void unloadTow() {
		System.out.println("UNLOAD TOW");

		System.out.println("END UnLOAD TOW");
	}
}
